<!DOCTYPE html>
<html>
<head>
  <title>Test - StringBuilder</title>
  <link rel="stylesheet" href="QUnit.css" type="text/css" />
  <script type="text/javascript" src="QUnit.js"></script>
  <script type="text/javascript" src="QUnitExt.js"></script>
</head>
<body>
  <h1 id="qunit-header">Test Results</h1>
  <h2 id="qunit-banner"></h2>
  <h2 id="qunit-userAgent"></h2>
  <ol id="qunit-tests"></ol>
  <br />
  <textarea id="qunit-log" rows="10" cols="100"></textarea>
</body>
<script type="text/javascript" src="..\..\bin\Debug\mscorlib.debug.js"></script>
<script type="text/javascript">
module('StringBuilder');
test('ctor', function() {
  var sb1 = new ss.StringBuilder();
  QUnit.equal(sb1.isEmpty, true);
  QUnit.equal(sb1.toString(), '');
  
  var sb2 = new ss.StringBuilder('aaa');
  QUnit.equal(sb2.isEmpty, false);
  QUnit.equal(sb2.toString(), 'aaa');
});

test('isEmpty', function() {
  var sb1 = new ss.StringBuilder();
  QUnit.equal(sb1.isEmpty, true);

  sb1.append('');
  QUnit.equal(sb1.isEmpty, true);
  
  sb1.append(null);
  QUnit.equal(sb1.isEmpty, true);
  
  sb1.append(undefined);
  QUnit.equal(sb1.isEmpty, true);

  sb1.append('aaa');
  QUnit.equal(sb1.isEmpty, false);
  QUnit.equal(sb1.toString(), 'aaa');
});

test('append', function() {
  var sb1 = new ss.StringBuilder();

  sb1.append('aaa');
  QUnit.equal(sb1.isEmpty, false);
  QUnit.equal(sb1.toString(), 'aaa');
  
  sb1.append('bbb');
  QUnit.equal(sb1.isEmpty, false);
  QUnit.equal(sb1.toString(), 'aaabbb');
});

test('toString', function() {
  var sb1 = new ss.StringBuilder();
  sb1.append('aaa');
  QUnit.equal(sb1.toString(':'), 'aaa');
  sb1.append('bbb');
  QUnit.equal(sb1.toString(':'), 'aaa:bbb');
});
</script>
</html>
